package com.ricchieri.manage.bean;

import java.io.Serializable;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

import com.ricchieri.common.BusinessSettings;
import com.ricchieri.util.FacesUtil;

@ManagedBean(name = "addCharterMB")
@ViewScoped
public class AddCharterManageBean extends CommonCharterManageBean implements Serializable{
	private static final long serialVersionUID = -239017604510658876L;
		
	public String getSelectedCharted() {
		return selectedCharted;
	}

	public String save() {
		if(this.validateForm()) {
			getCharter().setCharterType(obtainCharterType(this.getSelectedCharted()));
			charterServices.addCharter(getCharter());
			FacesUtil.addParametersFlash(BusinessSettings.KEY_CHARTER, getCharter());
			return BusinessSettings.SUCCESS;
		}
		return "";
	}
	
	@Override
	public Boolean isRequiredCharter() {
		return Boolean.FALSE;
	}
	
}
